<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改试卷管理')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-examPaper-edit" th:object="${examPaper}">
            <input name="examId" th:field="*{examId}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">考卷名称：</label>
                <div class="col-sm-8">
                    <input name="examName" th:field="*{examName}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">总分：</label>
                <div class="col-sm-8">
                    <input name="allPoints" th:field="*{allPoints}" class="form-control" type="text" required readonly>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">题目数量：</label>
                <div class="col-sm-8">
                    <input name="quesNum" th:field="*{quesNum}" class="form-control" type="text" required readonly>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">试卷类型：</label>
                <div class="col-sm-8">
                    <select name="learnType" class="form-control m-b" th:with="type=${@dict.getType('learn_type')}" required disabled>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{learnType}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">及格分数：</label>
                <div class="col-sm-8">
                    <input name="passPoints" th:field="*{passPoints}" class="form-control" type="number" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">考试时长：</label>
                <div class="col-sm-8">
                    <input name="duration" th:field="*{duration}" class="form-control" type="number">
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label font-noraml">截止时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input type="text" class="form-control" id="endTime" name="endTime" th:value="${#dates.format(examPaper.endTime, 'yyyy-MM-dd HH:mm:ss')}">
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "web/examPaper";
        $("#form-examPaper-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-examPaper-edit').serialize());
            }
        }
        layui.use('laydate', function(){
            var laydate = layui.laydate;
            laydate.render({
                elem: '#startTime',
                type: 'datetime',
                trigger: 'click'
            });
            laydate.render({
                elem: '#endTime',
                type: 'datetime',
                trigger: 'click'
            });
        })
    </script>
</body>
</html>